package com.example.blog.modules.system.entity;

import com.example.blog.common.base.BaseEntity;
import com.example.blog.modules.user.entity.User;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@Entity
@Table(name = "sys_notifications")
@EqualsAndHashCode(callSuper = true)
public class Notification extends BaseEntity {

    @Column(nullable = false)
    private String title;

    @Column(nullable = false, columnDefinition = "TEXT")
    private String content;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private User user;

    @Column(nullable = false)
    private String type;

    @Column(nullable = false)
    private Boolean isRead = false;

    private String targetType;

    private Long targetId;

    @Column(nullable = false)
    private Integer level = 0;  // 0: 普通, 1: 重要, 2: 紧急

    @Column(nullable = false)
    private Boolean isSystem = false;  // 是否是系统通知
} 